home *** CD-ROM | disk | FTP | other *** search
/ Robotics & Artificial Int…3 (Professional Edition) / Robotics & Artificial Intelligence Tools 2003 (Professional Edition).iso / neural network tool and application / nsinstall.exe / data1.cab / DllSys_Files / CONTAXON / SIGCONTA.C < prev    next >
Encoding:
C/C++ Source or Header  |  2002-03-08  |  1.4 KB  |  43 lines

  1. // Dynamic link library implementation of NeuroSolutions SigmoidContextAxon component 
  2.  
  3. #include "NSDLL.h"
  4.  
  5. /***********************************/
  6. /* Forward activation of component */
  7.  
  8. __declspec(dllexport) void performContextAxon(
  9.     DLLData *instance,        // Pointer to instance data (may be NULL)
  10.     NSFloat    *data,             // Pointer to the layer of processing elements (PEs)
  11.     int     rows,            // Number of rows of PEs in the layer
  12.     int     cols,            // Number of columns of PEs in the layer
  13.     NSFloat    *delayedData,     // Pointer to a PE layer delayed by a single time step
  14.     NSFloat    *tau,            // Pointer to a vector of time constants, one for each PE
  15.     NSFloat    beta            // Linear scaling factor controlled within the components inspector
  16.     )
  17. {
  18.     int i, length=rows*cols;
  19.  
  20.     for (i=0; i<length; i++) {
  21.         data[i] = (NSFloat)(1.0/(1.0+exp(-data[i])));
  22.         data[i] = beta * (data[i] + tau[i] * delayedData[i]);
  23.     }
  24. }
  25.  
  26. /******************************************/
  27. /* Management of instance data (OPTIONAL) */
  28. /*
  29. __declspec(dllexport) DLLData *allocContextAxon(
  30.     DLLData    *oldInstance,    // Pointer to the last instance if reallocating
  31.     int     rows,        // Number of rows of PEs in the layer
  32.     int     cols        // Number of columns of PEs in the layer
  33.     )
  34. {
  35.     DLLData *instance = allocDLLInstance(oldInstance);
  36.     return instance;
  37. }
  38.  
  39. __declspec(dllexport) void freeContextAxon(DLLData *instance)
  40. {
  41.     freeDLLInstance(instance);
  42. }
  43. */